file(GLOB_RECURSE SRC_SOL2 src *.cpp *.h *.hpp *.lua )

add_executable(test_sol2 ${SRC_SOL2})

IF (CMAKE_SYSTEM_NAME MATCHES "Windows")
    include_directories( $ENV{sol_path}/include
		$ENV{spdlog_path}/include
		$ENV{LuaJIT_CURR_PATH}/src
    )
	
    add_definitions(-DWIN32)
    add_definitions(-DWIN32_LEAN_AND_MEAN)
    add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
	
	target_link_libraries(test_sol2 
		$ENV{LuaJIT_CURR_PATH}/src/lua51.lib)

	# 需要拷贝的dll文件列表
	SET (COPY_FILE_LIST $ENV{LuaJIT_CURR_PATH}/src/lua51.dll
		$ENV{LuaJIT_CURR_PATH}/src/luajit.exe
		 )
	# 拷贝dll文件
	file(COPY ${COPY_FILE_LIST} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug)
	file(COPY ${COPY_FILE_LIST} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Release)

	
	# lua
	SET (COPY_LUA_FILE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/src/main.lua)
	file(COPY ${COPY_LUA_FILE_LIST} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

ELSE()
    set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
    set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
	add_definitions(-DLinux)
	target_link_libraries(test_sol2 lua51)
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Windows")


